package com.css.fxfzypg.modules.dataVolumeStatistics.service.impl;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.css.fxfzypg.base.response.RestResponse;
import com.css.fxfzypg.constants.YNEnum;
import com.css.fxfzypg.manage.building.repository.entity.BuildingEntity;
import com.css.fxfzypg.manage.disasterrisk.repository.entity.DisasterRiskEntity;
import com.css.fxfzypg.manage.sampling.repository.entity.SamplingEntity;
import com.css.fxfzypg.modules.ScheduleTask.*;
import com.css.fxfzypg.modules.dataVolumeStatistics.entity.DataVolumeEntity;
import com.css.fxfzypg.modules.dataVolumeStatistics.entity.JcDsGpbGdzcGridTotalHousing;
import com.css.fxfzypg.modules.dataVolumeStatistics.repository.DataLumeRepository;
import com.css.fxfzypg.modules.dataVolumeStatistics.service.DataVoLumeService;
import com.css.fxfzypg.modules.dataVolumeStatistics.vo.HeightAndSlopeVO;
import com.css.fxfzypg.modules.preassesstaskmanage.entity.PreAssessTaskEntity;
import com.css.fxfzypg.modules.preassesstaskmanage.service.PreAssessTaskService;
import com.css.fxfzypg.modules.resultManagement.reportManagement.entity.FieldHistoryUploadReport;
import com.css.fxfzypg.modules.resultManagement.reportManagement.entity.ReportManagement;
import com.css.fxfzypg.modules.resultManagement.reportManagement.repository.ReportManagementRepository;
import com.css.fxfzypg.modules.resultManagement.reportManagement.repository.SamplingSurveyReportRepository;
import com.css.fxfzypg.util.FileUploadUtil;
import com.css.fxfzypg.util.PlatformObjectUtils;
import com.css.fxfzypg.util.RestTemplateUtil;
import com.css.fxfzypg.util.UUIDGenerator;
import org.slw.common.helper.PropsHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.stream.Collectors;

/**
 * @author y1fan
 * @description
 */
@Service
public class DataVoLumeServiceImpl implements DataVoLumeService {


    @Resource
    private DataLumeRepository dataLumeRepository;

    @Resource
    private RestTemplateUtil restTemplateUtil;

    @Resource
    private ReportManagementRepository reportManagementRepository;


    @Resource
    private SamplingSurveyReportRepository samplingSurveyReportRepository;

    @Override
    public void getDataVolumeToPg() {
        dataLumeRepository.delete();
        Properties configGroup = PropsHelper.loadProps("slw-config.properties");
        String url = configGroup.getProperty("baseRestUrl") + "/sorg_dzj/getAllCounCount";
        Map<String, Object> paramMap = new HashMap<>();
        ResponseEntity<String> responseEntity = restTemplateUtil.sendHttpRequest(url, paramMap);
        String body = responseEntity.getBody();
        List<DataVolumeEntity> entities = JSON.parseArray(body, DataVolumeEntity.class);

        Integer countyNumHJ=0;//区县总个数
        Integer divisionNumHJ=0;//行政区划个数
        Integer divisionNumTHJ=0;//行政区划个数
        BigDecimal divisionProportionHJ=BigDecimal.ZERO;//行政区划占比
        Integer heightNumHJ=0;//高程个数
        Integer heightNumTHJ=0;//高程个数
        BigDecimal heightProportionHJ=BigDecimal.ZERO;//高程个数占比
        Integer slopeNumHJ=0;//坡度个数
        Integer slopeNumTHJ=0;//坡度个数
        BigDecimal slopeProportionHJ=BigDecimal.ZERO;//坡度个数占比
        Integer gridNumHJ=0;//人口建筑物经济公里格网个数
        Integer gridNumTHJ=0;//人口建筑物经济公里格网个数
        BigDecimal gridProportionHJ=BigDecimal.ZERO;//人口建筑物经济公里格网占比
        Integer roadNumHJ=0;//道路个数
        Integer roadNumTHJ=0;//道路个数
        BigDecimal roadProportionHJ=BigDecimal.ZERO;//道路占比
        Integer airportNumHJ=0;//机场个数
        Integer airportNumTHJ=0;//机场个数
        BigDecimal airportProportionHJ=BigDecimal.ZERO;//机场占比
        Integer reservoirNumHJ=0;//水库个数
        Integer reservoirNumTHJ=0;//水库个数
        BigDecimal reservoirProportionHJ=BigDecimal.ZERO;//水库占比
        Integer schoolNumHJ=0;//学校个数
        Integer schoolNumTHJ=0;//学校个数
        BigDecimal schoolProportionHJ=BigDecimal.ZERO;//学校占比
        Integer hospitalNumHJ=0;//医院个数
        Integer hospitalNumTHJ=0;//医院个数
        BigDecimal hospitalProportionHJ=BigDecimal.ZERO;//医院占比
        Integer dzzhNumHJ=0;//地质灾害个数
        Integer dzzhNumTHJ=0;//地质灾害个数
        BigDecimal dzzhProportionHJ=BigDecimal.ZERO;//地质灾害占比
        Integer hddcNumHJ=0;//活动断层个数
        Integer hddcNumTHJ=0;//活动断层个数
        BigDecimal hddcProportionHJ=BigDecimal.ZERO;//活动断层占比
        Integer dangerousNumHJ=0;//危化企业个数
        Integer dangerousNumTHJ=0;//危化企业个数
        BigDecimal dangerousProportionHJ=BigDecimal.ZERO;//危化企业占比
        Integer gasNumHJ=0;//加油加气站个数
        Integer gasNumTHJ=0;//加油加气站个数
        BigDecimal gasProportionHJ=BigDecimal.ZERO;//加油加气站占比
        Integer emergencyNumHJ=0;//应急避难场所个数
        Integer emergencyNumTHJ=0;//应急避难场所个数
        BigDecimal emergencyProportionHJ=BigDecimal.ZERO;//应急避难场所占比
        Integer rsNumHJ=0;//基于遥感的房屋抗震能力初步评估数据个数
        Integer rsNumTHJ=0;//基于遥感的房屋抗震能力初步评估数据个数
        BigDecimal rsProportionHJ=BigDecimal.ZERO;//基于遥感的房屋抗震能力初步评估数据占比
        Integer informationNumHJ=0;//历史地震信息数据个数
        Integer informationNumTHJ=0;//历史地震信息数据个数
        BigDecimal informationProportionHJ=BigDecimal.ZERO;//历史地震信息数据占比
        Integer disasterNumHJ=0;//历史地震灾害数据个数
        Integer disasterNumTHJ=0;//历史地震灾害数据个数
        BigDecimal disasterProportionHJ=BigDecimal.ZERO;//历史地震灾害数据占比
        Integer preAppraisalNumHJ=0;//历史预评估数据个数
        Integer preAppraisalNumTHJ=0;//历史预评估数据个数
        BigDecimal preAppraisalProportionHJ=BigDecimal.ZERO;//历史预评估数据占比
        Integer districtInNumHJ=0;//区县综合信息个数
        Integer districtInNumTHJ=0;//区县综合信息个数
        BigDecimal districtInProportionHJ=BigDecimal.ZERO;//区县综合信息占比
        Integer townshipInNumHJ=0;//乡镇综合信息个数
        Integer townshipInNumTHJ=0;//乡镇综合信息个数
        BigDecimal townshipInProportionHJ=BigDecimal.ZERO;//乡镇综合信息占比
        Integer districtPoNumHJ=0;//区县综合人口建筑物数据个数
        Integer districtPoNumTHJ=0;//区县综合人口建筑物数据个数
        BigDecimal districtPoProportionHJ=BigDecimal.ZERO;//区县综合人口建筑物数据占比
        Integer townshipPoNumHJ=0;//乡镇综合人口建筑物数据个数
        Integer townshipPoNumTHJ=0;//乡镇综合人口建筑物数据个数
        BigDecimal townshipPoProportionHJ=BigDecimal.ZERO;//乡镇综合人口建筑物数据占比
        Integer populationCensusNumHJ=0;//人口普查数据
        Integer populationCensusNumTHJ=0;//人口普查数据
        BigDecimal populationCensusProportionHJ=BigDecimal.ZERO;//人口普查数据占比
        Integer buildingNumHJ=0;//建筑物易损性数据
        Integer buildingNumTHJ=0;//建筑物易损性数据
        BigDecimal buildingProportionHJ=BigDecimal.ZERO;//建筑物易损性数据占比
        Integer houseNumHJ=0;//房屋造价数据
        Integer houseNumTHJ=0;//房屋造价数据
        BigDecimal houseProportionHJ=BigDecimal.ZERO;//房屋造价数据占比
        Integer projectNumHJ=0;//重大工程基础设施数据
        Integer projectNumTHJ=0;//重大工程基础设施数据
        BigDecimal projectProportionHJ=BigDecimal.ZERO;//重大工程基础设施数据占比
        Integer gdpNumHJ=0;//GDP数据
        Integer gdpNumTHJ=0;//GDP数据
        BigDecimal gdpProportionHJ=BigDecimal.ZERO;//GDP数据占比
        Integer contingencyNumHJ=0;//应急准备数据
        Integer contingencyNumTHJ=0;//应急准备数据
        BigDecimal contingencyProportionHJ=BigDecimal.ZERO;//应急准备数据占比
        Integer buildingsUnitNumHJ=0;//建筑物单体数据
        Integer buildingsUnitNumTHJ=0;//建筑物单体数据
        BigDecimal buildingsUnitProportionHJ=BigDecimal.ZERO;//建筑物单体数据占比
        Integer surveyPointNumHJ=0;//抽样调查点数据
        Integer surveyPointNumTHJ=0;//抽样调查点数据
        BigDecimal surveyPointProportionHJ=BigDecimal.ZERO;//抽样调查点占比
        Integer riskPointNumHJ=0;//灾害风险点数据
        Integer riskPointNumTHJ=0;//灾害风险点数据
        BigDecimal riskPointProportionHJ=BigDecimal.ZERO;//灾害风险点占比
        Integer fatalNumHJ=0;//区县致死性差异指标数据
        Integer fatalNumTHJ=0;//区县致死性差异指标数据
        BigDecimal fatalProportionHJ=BigDecimal.ZERO;//区县致死性差异指标数据占比

        for (DataVolumeEntity entity : entities) {
            entity.setId(UUIDGenerator.getUUID());
            String province = entity.getProvince();
            Integer countyNum = entity.getCountyNum();
            BigDecimal num = new BigDecimal(Double.valueOf(countyNum));
            //行政区划
            Integer divisionNum = dataLumeRepository.getDivisionNum(province,YNEnum.N.toString());
            Integer divisionTNum = dataLumeRepository.getDivisionNum(province,YNEnum.Y.toString());
            entity.setDivisionNum(divisionNum);
            divisionNumTHJ+=divisionTNum;
            entity.setDivisionProportion(new BigDecimal(Double.valueOf(divisionNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            //地形地貌（高程）_
            List<HeightAndSlopeVO> heightNumlist=dataLumeRepository.getHeightNum(province, "地形地貌（高程）_");
            Integer heightNum=0;
            for (HeightAndSlopeVO heightentity : heightNumlist) {
                if (PlatformObjectUtils.isEmpty(heightentity.getArea())&&PlatformObjectUtils.isEmpty(heightentity.getCity())){
                    heightNum=entity.getCountyNum();
                    heightNumTHJ=heightentity.getDataLength();
                    break;
                }
                if (PlatformObjectUtils.isEmpty(heightentity.getArea())&&PlatformObjectUtils.isNotEmpty(heightentity.getCity())){
                    heightNum+=dataLumeRepository.getcountyNumByCity(heightentity.getCity());
                    heightNumTHJ+=heightentity.getDataLength();
                    continue;
                }
                if (PlatformObjectUtils.isNotEmpty(heightentity.getArea())){
                    heightNum=heightNumlist.size();
                    heightNumTHJ+=heightentity.getDataLength();
                }
            }
            entity.setHeightNum(heightNum);
            entity.setHeightProportion(new BigDecimal(Double.valueOf(heightNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            //地形地貌（坡度）_
            List<HeightAndSlopeVO> slopeNumlist=dataLumeRepository.getHeightNum(province, "地形地貌（坡度）_");
            Integer slopeNum=0;
            for (HeightAndSlopeVO slopeEntity : slopeNumlist) {
                if (PlatformObjectUtils.isEmpty(slopeEntity.getArea())&&PlatformObjectUtils.isEmpty(slopeEntity.getCity())){
                    slopeNum=entity.getCountyNum();
                    slopeNumTHJ+=slopeEntity.getDataLength();
                    break;
                }
                if (PlatformObjectUtils.isEmpty(slopeEntity.getArea())&&PlatformObjectUtils.isNotEmpty(slopeEntity.getCity())){
                    slopeNum+=dataLumeRepository.getcountyNumByCity(slopeEntity.getCity());
                    slopeNumTHJ+=slopeEntity.getDataLength();
                    continue;
                }
                if (PlatformObjectUtils.isNotEmpty(slopeEntity.getArea())){
                    slopeNum=slopeNumlist.size();
                    slopeNumTHJ+=slopeEntity.getDataLength();
                }
            }
            entity.setSlopeNum(slopeNum);
            entity.setSlopeProportion(new BigDecimal(Double.valueOf(slopeNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
         /* *//*  //地形地貌（坡度）_
            Integer slopeNum=dataLumeRepository.getSlopeNum(province,YNEnum.N.toString());
            Integer slopeTNum=dataLumeRepository.getSlopeNum(province,YNEnum.Y.toString());*//*
            entity.setSlopeNum(slopeNum);
            entity.setSlopeProportion(String.valueOf(new BigDecimal(Double.valueOf(slopeNum)*100).divide(num,2, RoundingMode.HALF_UP)));
           */
            //人口建筑物公里格网
            Integer gridNum = dataLumeRepository.getGridNum(province, YNEnum.N.toString());
            Integer gridTNum = dataLumeRepository.getGridNum(province, YNEnum.Y.toString());
            entity.setGridNum(gridNum);
            gridNumTHJ+=gridTNum;
            entity.setGridProportion(new BigDecimal(Double.valueOf(gridNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            //交通（道路）
            Integer roadNum = dataLumeRepository.getRoadNum(province, YNEnum.N.toString());
            Integer roadTNum = dataLumeRepository.getRoadNum(province, YNEnum.Y.toString());
            entity.setRoadNum(roadNum);
            roadNumTHJ+=roadTNum;
            entity.setRoadProportion(new BigDecimal(Double.valueOf(roadNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            //交通（机场）
            Integer airportNum = dataLumeRepository.getAirportNum(province, YNEnum.N.toString());
            Integer airportTNum = dataLumeRepository.getAirportNum(province, YNEnum.Y.toString());
            entity.setAirportNum(airportNum);
            airportNumTHJ+=airportTNum;
            entity.setAirportProportion(new BigDecimal(Double.valueOf(airportNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            //水库
            Integer reservoirNum=dataLumeRepository.getReservoirNum(province,YNEnum.N.toString());
            Integer reservoirTNum=dataLumeRepository.getReservoirNum(province,YNEnum.Y.toString());
            entity.setReservoirNum(reservoirNum);
            reservoirNumTHJ+=reservoirTNum;
            entity.setReservoirProportion(new BigDecimal(Double.valueOf(reservoirNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            //学校
            Integer schoolNum=dataLumeRepository.getSchoolNum(province,YNEnum.N.toString());
            Integer schoolTNum=dataLumeRepository.getSchoolNum(province,YNEnum.Y.toString());
            entity.setSchoolNum(schoolNum);
            schoolNumTHJ+=schoolTNum;
            entity.setSchoolProportion(new BigDecimal(Double.valueOf(schoolNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            //医院
            Integer hospitalNum=dataLumeRepository.getHospitalNum(province,YNEnum.N.toString());
            Integer hospitalTNum=dataLumeRepository.getHospitalNum(province,YNEnum.Y.toString());
            entity.setHospitalNum(hospitalNum);
            hospitalNumTHJ+=hospitalTNum;
            entity.setHospitalProportion(new BigDecimal(Double.valueOf(hospitalNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            //地质灾害
            Integer dzzhNum=dataLumeRepository.getDzzhNum(province,YNEnum.N.toString());
            Integer dzzhTNum=dataLumeRepository.getDzzhNum(province,YNEnum.Y.toString());
            entity.setDzzhNum(dzzhNum);
            dzzhNumTHJ+=dzzhTNum;
            entity.setDzzhProportion(new BigDecimal(Double.valueOf(dzzhNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            //断层
            Integer hddzNum=dataLumeRepository.getHddzNum(province,YNEnum.N.toString());
            Integer hddzTNum=dataLumeRepository.getHddzNum(province,YNEnum.Y.toString());
            entity.setHddcNum(hddzNum);
            hddcNumTHJ+=hddzTNum;
            entity.setHddcProportion(new BigDecimal(Double.valueOf(hddzNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            //次生灾害危险源（危化企业）
            Integer dangerousNum=dataLumeRepository.getDangerousNum(province,YNEnum.N.toString());
            Integer dangerousTNum=dataLumeRepository.getDangerousNum(province,YNEnum.Y.toString());
            entity.setDangerousNum(dangerousNum);
            dangerousNumTHJ+=dangerousTNum;
            entity.setDangerousProportion(new BigDecimal(Double.valueOf(dangerousNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            //次生灾害危险源（加油站）_
            Integer gasNum=dataLumeRepository.getGasNum(province,YNEnum.N.toString());
            Integer gasTNum=dataLumeRepository.getGasNum(province,YNEnum.Y.toString());
            entity.setGasNum(gasNum);
            gasNumTHJ+=gasTNum;
            entity.setGasProportion(new BigDecimal(Double.valueOf(gasNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            //应急避难场所_
            Integer emergencyNum=dataLumeRepository.getEmergencyNum(province,YNEnum.N.toString());
            Integer emergencyTNum=dataLumeRepository.getEmergencyNum(province,YNEnum.Y.toString());
            entity.setEmergencyNum(emergencyNum);
            emergencyNumTHJ+=emergencyTNum;
            entity.setEmergencyProportion(new BigDecimal(Double.valueOf(emergencyNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            //基于遥感房屋抗震能力分区图_
            Integer rsNum=dataLumeRepository.getRsNum(province,YNEnum.N.toString());
            Integer rsTNum=dataLumeRepository.getRsNum(province,YNEnum.Y.toString());
            entity.setRsNum(rsNum);
            rsNumTHJ+=rsTNum;
            entity.setRsProportion(new BigDecimal(Double.valueOf(rsNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            //历史地震信息
            Integer informationNum=dataLumeRepository.getHisEarthNumByProvince(province,YNEnum.N.toString());
            Integer informationTNum=dataLumeRepository.getHisEarthNumByProvince(province,YNEnum.Y.toString());
            entity.setInformationNum(informationNum);
            informationNumTHJ+=informationTNum;
            entity.setInformationProportion(new BigDecimal(Double.valueOf(informationNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            //历史地震灾害数据
            Integer disasterNum=dataLumeRepository.getDisasterNumByProvince(province,YNEnum.N.toString());
            Integer disasterTNum=dataLumeRepository.getDisasterNumByProvince(province,YNEnum.Y.toString());
            entity.setDisasterNum(disasterNum);
            disasterNumTHJ+=disasterTNum;
            entity.setDisasterProportion(new BigDecimal(Double.valueOf(disasterNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            //历史预评估数据
            Integer preAppraisalNum=dataLumeRepository.getPreAppraisalNum(province,YNEnum.N.toString());
            Integer preAppraisalTNum=dataLumeRepository.getPreAppraisalNum(province,YNEnum.Y.toString());
            entity.setPreAppraisalNum(preAppraisalNum);
            preAppraisalNumTHJ+=preAppraisalTNum;
            entity.setPreAppraisalProportion(new BigDecimal(Double.valueOf(preAppraisalNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            //区县综合信息概况
            Integer districtInNum=dataLumeRepository.getDistrictInNum(province,YNEnum.N.toString());
            Integer districtInTNum=dataLumeRepository.getDistrictInNum(province,YNEnum.Y.toString());
            entity.setDistrictInNum(districtInNum);
            districtInNumTHJ+=districtInTNum;
            entity.setDistrictInProportion(new BigDecimal(Double.valueOf(districtInNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            //乡镇综合概况
            Integer townshipInNum=dataLumeRepository.getTownshipInNum(province,YNEnum.N.toString());
            Integer townshipInTNum=dataLumeRepository.getTownshipInNum(province,YNEnum.Y.toString());
            entity.setTownshipInNum(townshipInNum);
            townshipInNumTHJ+=townshipInTNum;
            entity.setTownshipInProportion(new BigDecimal(Double.valueOf(townshipInNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            //区县人口和建筑物概况信息
            Integer districtPoNum=dataLumeRepository.getDistrictPoNum(province,YNEnum.N.toString());
            Integer districtPoTNum=dataLumeRepository.getDistrictPoNum(province,YNEnum.Y.toString());
            entity.setDistrictPoNum(districtPoNum);
            districtPoNumTHJ+=districtPoTNum;
            entity.setDistrictPoProportion(new BigDecimal(Double.valueOf(districtPoNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            //农村人口和建筑物概况信息
            Integer townshipPoNum=dataLumeRepository.getTownshipPoNum(province,YNEnum.N.toString());
            Integer townshipPoTNum=dataLumeRepository.getTownshipPoNum(province,YNEnum.Y.toString());
            entity.setTownshipPoNum(townshipPoNum);
            townshipPoNumTHJ+=townshipPoTNum;
            entity.setTownshipPoProportion(new BigDecimal(Double.valueOf(townshipPoNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            //人口普查数据
            Integer populationCensusNum=dataLumeRepository.getPopulationCensusNum(province,YNEnum.N.toString());
            Integer populationCensusTNum=dataLumeRepository.getPopulationCensusNum(province,YNEnum.Y.toString());
            entity.setPopulationCensusNum(populationCensusNum);
            populationCensusNumTHJ+=populationCensusTNum;
            entity.setPopulationCensusProportion(new BigDecimal(Double.valueOf(populationCensusNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            //建筑物易损性
            Integer buildingNum=dataLumeRepository.getBuildingNum(province,YNEnum.N.toString());
            Integer buildingTNum=dataLumeRepository.getBuildingNum(province,YNEnum.Y.toString());
            entity.setBuildingNum(buildingNum);
            buildingNumTHJ+=buildingTNum;
            entity.setBuildingProportion(new BigDecimal(Double.valueOf(buildingNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            //房屋造价数据
            Integer houseNum=dataLumeRepository.getHouseNum(province,YNEnum.N.toString());
            Integer houseTNum=dataLumeRepository.getHouseNum(province,YNEnum.Y.toString());
            entity.setHouseNum(houseNum);
            houseNumTHJ+=houseTNum;
            entity.setHouseProportion(new BigDecimal(Double.valueOf(houseNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            //重大工程基础设施
            Integer projectNum=dataLumeRepository.getProjectNum(province,YNEnum.N.toString());
            Integer projectTNum=dataLumeRepository.getProjectNum(province,YNEnum.Y.toString());
            entity.setProjectNum(projectNum);
            projectNumTHJ+=projectTNum;
            entity.setProjectProportion(new BigDecimal(Double.valueOf(projectNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            //GDP
            Integer gdpNum=dataLumeRepository.getGdpNum(province,YNEnum.N.toString());
            Integer gdpTNum=dataLumeRepository.getGdpNum(province,YNEnum.Y.toString());
            entity.setGdpNum(gdpNum);
            gdpNumTHJ+=gdpTNum;
            entity.setGdpProportion(new BigDecimal(Double.valueOf(gdpNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            //应急准备情况
            Integer contingencyNum=dataLumeRepository.getContingencyNum(province,YNEnum.N.toString());
            Integer contingencyTNum=dataLumeRepository.getContingencyNum(province,YNEnum.Y.toString());
            entity.setContingencyNum(contingencyNum);
            contingencyNumTHJ+=contingencyTNum;
            entity.setContingencyProportion(new BigDecimal(Double.valueOf(contingencyNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            // 建筑物单体数据
            Integer buildingsUnitNum=dataLumeRepository.getBuildingsUnitNum(province,YNEnum.N.toString());
            Integer buildingsUnitTNum=dataLumeRepository.getBuildingsUnitNum(province,YNEnum.Y.toString());
            entity.setBuildingsUnitNum(buildingsUnitNum);
            buildingsUnitNumTHJ+=buildingsUnitTNum;
            entity.setBuildingsUnitProportion(new BigDecimal(Double.valueOf(buildingsUnitNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            //抽样调查点概况信息
            Integer surveyPointNum=dataLumeRepository.getSurveyPointNum(province,YNEnum.N.toString());
            Integer surveyPointTNum=dataLumeRepository.getSurveyPointNum(province,YNEnum.Y.toString());
            entity.setSurveyPointNum(surveyPointNum);
            surveyPointNumTHJ+=surveyPointTNum;
            entity.setSurveyPointProportion(new BigDecimal(Double.valueOf(surveyPointNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            //灾害风险点
            Integer riskPointNum=dataLumeRepository.getRiskPointNum(province,YNEnum.N.toString());
            Integer riskPointTNum=dataLumeRepository.getRiskPointNum(province,YNEnum.Y.toString());
            entity.setRiskPointNum(riskPointNum);
            riskPointNumTHJ+=riskPointTNum;
            entity.setRiskPointProportion(new BigDecimal(Double.valueOf(riskPointNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));
            //区县致死性
            Integer fatalNum=dataLumeRepository.getfatalNum(province,YNEnum.N.toString());
            Integer fatalTNum=dataLumeRepository.getfatalNum(province,YNEnum.Y.toString());
            entity.setFatalNum(fatalNum);
            fatalNumTHJ+=fatalTNum;
            entity.setFatalProportion(new BigDecimal(Double.valueOf(fatalNum)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP));

            //合计
            countyNumHJ+=entity.getCountyNum();
            divisionNumHJ+=entity.getDivisionNum();
            heightNumHJ+=entity.getHeightNum();
            slopeNumHJ+=entity.getSlopeNum();
            gridNumHJ+=entity.getGridNum();
            roadNumHJ+=entity.getRoadNum();
            airportNumHJ+=entity.getAirportNum();
            reservoirNumHJ+=entity.getReservoirNum();
            schoolNumHJ+=entity.getSchoolNum();
            hospitalNumHJ+=entity.getHospitalNum();
            dzzhNumHJ+=entity.getDzzhNum();
            hddcNumHJ+=entity.getHddcNum();
            dangerousNumHJ+=entity.getDangerousNum();
            gasNumHJ+=entity.getGasNum();
            emergencyNumHJ+=entity.getEmergencyNum();
            rsNumHJ+=entity.getRsNum();
            informationNumHJ+=entity.getInformationNum();
            disasterNumHJ+=entity.getDisasterNum();
            preAppraisalNumHJ+=entity.getPreAppraisalNum();
            districtInNumHJ+=entity.getDistrictInNum();
            townshipInNumHJ+=entity.getTownshipInNum();
            districtPoNumHJ+=entity.getDistrictPoNum();
            townshipPoNumHJ+=entity.getTownshipPoNum();
            populationCensusNumHJ+=entity.getPopulationCensusNum();
            buildingNumHJ+=entity.getBuildingNum();
            houseNumHJ+=entity.getHouseNum();
            projectNumHJ+=entity.getProjectNum();
            gdpNumHJ+=entity.getGdpNum();
            contingencyNumHJ+=entity.getContingencyNum();
            buildingsUnitNumHJ+=entity.getBuildingsUnitNum();
            surveyPointNumHJ+=entity.getSurveyPointNum();
            riskPointNumHJ+=entity.getRiskPointNum();
            fatalNumHJ+=entity.getFatalNum();
        }
        BigDecimal num = new BigDecimal(Double.valueOf(countyNumHJ));
        DataVolumeEntity entityHeji=new DataVolumeEntity();
        divisionProportionHJ=new BigDecimal(Double.valueOf(divisionNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setDivisionProportion(divisionProportionHJ);
        entityHeji.setDivisionNum(divisionNumHJ);
        heightProportionHJ=new BigDecimal(Double.valueOf(heightNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setHeightProportion(heightProportionHJ);
        entityHeji.setHeightNum(heightNumHJ);
        slopeProportionHJ=new BigDecimal(Double.valueOf(slopeNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setSlopeProportion(slopeProportionHJ);
        entityHeji.setSlopeNum(slopeNumHJ);
        gridProportionHJ=new BigDecimal(Double.valueOf(gridNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setGridProportion(gridProportionHJ);
        entityHeji.setGridNum(gridNumHJ);
        roadProportionHJ=new BigDecimal(Double.valueOf(roadNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setRoadProportion(roadProportionHJ);
        entityHeji.setRoadNum(roadNumHJ);
        airportProportionHJ=new BigDecimal(Double.valueOf(airportNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setAirportProportion(airportProportionHJ);
        entityHeji.setAirportNum(airportNumHJ);
        reservoirProportionHJ=new BigDecimal(Double.valueOf(reservoirNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setReservoirProportion(reservoirProportionHJ);
        entityHeji.setReservoirNum(reservoirNumHJ);
        schoolProportionHJ=new BigDecimal(Double.valueOf(schoolNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setSchoolProportion(schoolProportionHJ);
        entityHeji.setSchoolNum(schoolNumHJ);
        hospitalProportionHJ=new BigDecimal(Double.valueOf(hospitalNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setHospitalProportion(hospitalProportionHJ);
        entityHeji.setHospitalNum(hospitalNumHJ);
        dzzhProportionHJ=new BigDecimal(Double.valueOf(dzzhNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setDzzhProportion(dzzhProportionHJ);
        entityHeji.setDzzhNum(dzzhNumHJ);
        hddcProportionHJ=new BigDecimal(Double.valueOf(hddcNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setHddcProportion(hddcProportionHJ);
        entityHeji.setHddcNum(hddcNumHJ);
        dangerousProportionHJ=new BigDecimal(Double.valueOf(dangerousNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setDangerousProportion(dangerousProportionHJ);
        entityHeji.setDangerousNum(dangerousNumHJ);
        gasProportionHJ=new BigDecimal(Double.valueOf(gasNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setGasProportion(gasProportionHJ);
        entityHeji.setGasNum(gasNumHJ);
        emergencyProportionHJ=new BigDecimal(Double.valueOf(emergencyNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setEmergencyProportion(emergencyProportionHJ);
        entityHeji.setEmergencyNum(emergencyNumHJ);
        rsProportionHJ=new BigDecimal(Double.valueOf(rsNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setRsProportion(rsProportionHJ);
        entityHeji.setRsNum(rsNumHJ);
        informationProportionHJ=new BigDecimal(Double.valueOf(informationNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setInformationProportion(informationProportionHJ);
        entityHeji.setInformationNum(informationNumHJ);
        disasterProportionHJ=new BigDecimal(Double.valueOf(disasterNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setDisasterProportion(disasterProportionHJ);
        entityHeji.setDisasterNum(disasterNumHJ);
        preAppraisalProportionHJ=new BigDecimal(Double.valueOf(preAppraisalNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setPreAppraisalProportion(preAppraisalProportionHJ);
        entityHeji.setPreAppraisalNum(preAppraisalNumHJ);
        districtInProportionHJ=new BigDecimal(Double.valueOf(districtInNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setDistrictInProportion(districtInProportionHJ);
        entityHeji.setDistrictInNum(districtInNumHJ);
        townshipInProportionHJ=new BigDecimal(Double.valueOf(townshipInNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setTownshipInProportion(townshipInProportionHJ);
        entityHeji.setTownshipInNum(townshipInNumHJ);
        districtPoProportionHJ=new BigDecimal(Double.valueOf(districtPoNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setDistrictInProportion(districtPoProportionHJ);
        entityHeji.setDistrictPoNum(districtPoNumHJ);
        townshipPoProportionHJ=new BigDecimal(Double.valueOf(townshipPoNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setTownshipPoProportion(townshipPoProportionHJ);
        entityHeji.setTownshipPoNum(townshipPoNumHJ);
        populationCensusProportionHJ=new BigDecimal(Double.valueOf(populationCensusNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setPopulationCensusProportion(populationCensusProportionHJ);
        entityHeji.setPopulationCensusNum(populationCensusNumHJ);
        buildingProportionHJ=new BigDecimal(Double.valueOf(buildingNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setBuildingProportion(buildingProportionHJ);
        entityHeji.setBuildingNum(buildingNumHJ);
        houseProportionHJ=new BigDecimal(Double.valueOf(houseNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setHouseProportion(houseProportionHJ);
        entityHeji.setHouseNum(houseNumHJ);
        projectProportionHJ=new BigDecimal(Double.valueOf(projectNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setProjectProportion(projectProportionHJ);
        entityHeji.setProjectNum(projectNumHJ);
        gdpProportionHJ=new BigDecimal(Double.valueOf(gdpNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setGdpProportion(gdpProportionHJ);
        entityHeji.setGdpNum(gdpNumHJ);
        contingencyProportionHJ=new BigDecimal(Double.valueOf(contingencyNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setContingencyProportion(contingencyProportionHJ);
        entityHeji.setContingencyNum(contingencyNumHJ);
        buildingsUnitProportionHJ=new BigDecimal(Double.valueOf(buildingsUnitNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setBuildingsUnitProportion(buildingsUnitProportionHJ);
        entityHeji.setBuildingsUnitNum(buildingsUnitNumHJ);
        surveyPointProportionHJ=new BigDecimal(Double.valueOf(surveyPointNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setSurveyPointProportion(surveyPointProportionHJ);
        entityHeji.setSurveyPointNum(surveyPointNumHJ);
        riskPointProportionHJ=new BigDecimal(Double.valueOf(riskPointNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setRiskPointProportion(riskPointProportionHJ);
        entityHeji.setRiskPointNum(riskPointNumHJ);
        fatalProportionHJ=new BigDecimal(Double.valueOf(fatalNumHJ)).divide(num,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100.00)).setScale(2, RoundingMode.HALF_UP);
        entityHeji.setFatalProportion(fatalProportionHJ);
        entityHeji.setFatalNum(fatalNumHJ);
        entityHeji.setId(UUIDGenerator.getUUID());
        entityHeji.setProvince("合计");
        entityHeji.setCode("999998");
        entityHeji.setCountyNum(countyNumHJ);
        //数据总条数合计
        DataVolumeEntity totalEntity=new DataVolumeEntity();
        totalEntity.setDivisionNum(divisionNumTHJ);
        totalEntity.setDivisionProportion(null);
        totalEntity.setHeightNum(heightNumTHJ);
        totalEntity.setHeightProportion(null);
        totalEntity.setSlopeNum(slopeNumTHJ);
        totalEntity.setSlopeProportion(null);
        totalEntity.setGridNum(gridNumTHJ);
        totalEntity.setGridProportion(null);
        totalEntity.setRoadNum(roadNumTHJ);
        totalEntity.setRoadProportion(null);
        totalEntity.setAirportNum(airportNumTHJ);
        totalEntity.setAirportProportion(null);
        totalEntity.setReservoirNum(reservoirNumTHJ);
        totalEntity.setReservoirProportion(null);
        totalEntity.setSchoolNum(schoolNumTHJ);
        totalEntity.setSchoolProportion(null);
        totalEntity.setHospitalNum(hospitalNumTHJ);
        totalEntity.setHospitalProportion(null);
        totalEntity.setDzzhNum(dzzhNumTHJ);
        totalEntity.setDzzhProportion(null);
        totalEntity.setHddcNum(hddcNumTHJ);
        totalEntity.setHddcProportion(null);
        totalEntity.setDangerousNum(dangerousNumTHJ);
        totalEntity.setDangerousProportion(null);
        totalEntity.setGasNum(gasNumTHJ);
        totalEntity.setGasProportion(null);
        totalEntity.setEmergencyNum(emergencyNumTHJ);
        totalEntity.setEmergencyProportion(null);
        totalEntity.setRsNum(rsNumTHJ);
        totalEntity.setRsProportion(null);
        totalEntity.setInformationNum(informationNumTHJ);
        totalEntity.setInformationProportion(null);
        totalEntity.setDisasterNum(disasterNumTHJ);
        totalEntity.setDisasterProportion(null);
        totalEntity.setPreAppraisalNum(preAppraisalNumTHJ);
        totalEntity.setPreAppraisalProportion(null);
        totalEntity.setDistrictInNum(districtInNumTHJ);
        totalEntity.setDistrictInProportion(null);
        totalEntity.setTownshipInNum(townshipInNumTHJ);
        totalEntity.setTownshipInProportion(null);
        totalEntity.setDistrictPoNum(districtPoNumTHJ);
        totalEntity.setDistrictPoProportion(null);
        totalEntity.setTownshipPoNum(townshipPoNumTHJ);
        totalEntity.setTownshipPoProportion(null);
        totalEntity.setPopulationCensusNum(populationCensusNumTHJ);
        totalEntity.setPopulationCensusProportion(null);
        totalEntity.setBuildingNum(buildingNumTHJ);
        totalEntity.setBuildingProportion(null);
        totalEntity.setHouseNum(houseNumTHJ);
        totalEntity.setHouseProportion(null);
        totalEntity.setProjectNum(projectNumTHJ);
        totalEntity.setProjectProportion(null);
        totalEntity.setGdpNum(gdpNumTHJ);
        totalEntity.setGdpProportion(null);
        totalEntity.setContingencyNum(contingencyNumTHJ);
        totalEntity.setContingencyProportion(null);
        totalEntity.setBuildingsUnitNum(buildingsUnitNumTHJ);
        totalEntity.setBuildingsUnitProportion(null);
        totalEntity.setSurveyPointNum(surveyPointNumTHJ);
        totalEntity.setSurveyPointProportion(null);
        totalEntity.setRiskPointNum(riskPointNumTHJ);
        totalEntity.setRiskPointProportion(null);
        totalEntity.setFatalNum(fatalNumTHJ);
        totalEntity.setFatalProportion(null);
        totalEntity.setProvince("数据条数合计");
        totalEntity.setCode("999999");
        totalEntity.setCountyNum(countyNumHJ);
        totalEntity.setId(UUIDGenerator.getUUID());
        entities.add(totalEntity);
        entities.add(entityHeji);
        dataLumeRepository.save(entities);
    }

    @Override
    public RestResponse getData() {
        List<DataVolumeEntity> list = dataLumeRepository.getData();
        if (PlatformObjectUtils.isEmpty(list)){
            return RestResponse.fail("数据正在维护，请您稍等几分钟");
        }
        return RestResponse.succeed(list);
    }
    @Autowired
    PreAssessTaskService preAssessTaskService;
    @Override
    public void downloadReport(String ypgId,String flag,HttpServletResponse res) {
        PreAssessTaskEntity ypgEntity = preAssessTaskService.getById(ypgId);
        if (PlatformObjectUtils.isNotEmpty(ypgEntity.getReportId())){
            ReportManagement report = reportManagementRepository.getReportById(ypgEntity.getReportId());
            String filePath = report.getReportPath();
            if ("0".equals(flag)){
                String fileName=report.getLocalUserUploadSimpleReportName();
                FileUploadUtil.downloadPDF(filePath + File.separator + fileName, res);
            }
            if ("1".equals(flag)){
                String fileName=report.getLocalUserUploadMinuteReportName();
                FileUploadUtil.downloadPDF(filePath + File.separator + fileName, res);
            }
        }
    }

    @Override
    public void downloadReportXc(String reportId, HttpServletResponse res) {
        FieldHistoryUploadReport report = samplingSurveyReportRepository.getHistoryUploadReportById(reportId);
        String filePath = report.getReportPath();
        String fileName = report.getLocalReportName();
        FileUploadUtil.downloadPDF(filePath+File.separator+fileName,res);
    }

    @Override
    public void coverage() {

       List<SamplingEntity> list=dataLumeRepository.coverage();
        Map<String, List<SamplingEntity>> proSampMap = list.stream().collect(Collectors.groupingBy(SamplingEntity::getProvince));
        Map<String, List<SamplingEntity>> citySampMap = list.stream().collect(Collectors.groupingBy(SamplingEntity::getCity));

        ArrayList<SamplingEntity> collect = list.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getProvince()))), ArrayList::new));
        ArrayList<SamplingEntity> cityCollect = list.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getCity()))), ArrayList::new));

        List<CoverageEntity> coverageList=new ArrayList<>();
        List<YpgProSurveyPointCount> surveyPointCounts=new ArrayList<>();
        for (SamplingEntity samplingEntity : collect) {
            if (!samplingEntity.getProvince().equals("北京市")||
                    !samplingEntity.getProvince().equals("上海市")||
            !samplingEntity.getProvince().equals("天津市")||
            !samplingEntity.getProvince().equals("重庆市")){
               //各省（直辖市）抽样调查点数量统计
                YpgProSurveyPointCount surveyPointCount=new YpgProSurveyPointCount();
                String province = samplingEntity.getProvince();//省名称
                int size = proSampMap.get(samplingEntity.getProvince()).size();//每个省的抽样调查点个数
                surveyPointCount.setCode("0");
                surveyPointCount.setId(UUIDGenerator.getUUID());
                surveyPointCount.setProvince(province);
                surveyPointCount.setSurveyPointNum(size);
                surveyPointCounts.add(surveyPointCount);

                //调查点覆盖率
                CoverageEntity coverageEntity =new CoverageEntity();
                Integer countyNum = dataLumeRepository.getcountyNumByProvince(province);//省区县个数
               // long countyCount = list.stream().map(item -> item.getArea()).distinct().count(); //该省所拥有的调查点的区县个数
              //  long townCount = list.stream().map(item -> item.getTownship()).distinct().count(); //该省所拥有的调查点的乡镇个数
                coverageEntity.setId(UUIDGenerator.getUUID());
                coverageEntity.setProvince(samplingEntity.getProvince());
                coverageEntity.setCode("0");
                coverageEntity.setCountyCoverage(String.valueOf(new BigDecimal(size).divide(new BigDecimal(countyNum),0,RoundingMode.HALF_UP).multiply(new BigDecimal(100.00))));
                coverageEntity.setVillageCoverage(String.valueOf(new BigDecimal(size).divide(new BigDecimal(countyNum),0,RoundingMode.HALF_UP).multiply(new BigDecimal(100.00))));
                coverageList.add(coverageEntity);
            }
        }
        for (SamplingEntity samplingEntity : cityCollect) {
            String code = dataLumeRepository.getProvinceCodeByProvinceId(samplingEntity.getProvince());
            //调查点覆盖率 市
            int size = citySampMap.get(samplingEntity.getCity()).size();//每个市的抽样调查点个数
            YpgProSurveyPointCount surveyPointCount=new YpgProSurveyPointCount();
            String city = samplingEntity.getCity();//市名称
            surveyPointCount.setCode(code);
            surveyPointCount.setId(UUIDGenerator.getUUID());
            surveyPointCount.setProvince(city);
            surveyPointCount.setSurveyPointNum(size);
            surveyPointCounts.add(surveyPointCount);


            CoverageEntity coverageEntity =new CoverageEntity();
            Integer countyNum = dataLumeRepository.getcountyNumByCity(samplingEntity.getCity());//市区县个数
            Integer townNum = 100;//乡个数
         //   long countyCount = list.stream().map(item -> item.getArea()).distinct().count(); //该市所拥有的调查点的区县个数
           // long townCount = list.stream().map(item -> item.getTownship()).distinct().count(); //该市所拥有的调查点的乡镇个数
            coverageEntity.setId(UUIDGenerator.getUUID());
            coverageEntity.setProvince(samplingEntity.getCity());
            coverageEntity.setCode(code);
            coverageEntity.setCountyCoverage(String.valueOf(new BigDecimal(size).divide(new BigDecimal(countyNum),2,RoundingMode.HALF_UP).multiply(new BigDecimal(100.00))));
            coverageEntity.setVillageCoverage(String.valueOf(new BigDecimal(size).divide(new BigDecimal(townNum),2,RoundingMode.HALF_UP).multiply(new BigDecimal(100.00))));
            coverageList.add(coverageEntity);
        }

      //  Integer countyNum =dataLumeRepository.getCountyNum(); //全国区县个数
        //按县统计，有调查点的区县个数/全国区县个数。
       // String countyCoverage =String.valueOf(Double.valueOf(list.size())/Double.valueOf(countyNum));




        dataLumeRepository.delCoverage();
        dataLumeRepository.delPointCounts();
        dataLumeRepository.saveCoverage(coverageList);
        dataLumeRepository.savePointCounts(surveyPointCounts);

    }

    @Override
    public void coverage2() {
        Properties configGroup = PropsHelper.loadProps("slw-config.properties");
        String url = configGroup.getProperty("sjxtRestUrl") + "/ypg/getJcDsGpbGdzcGridTotalHousing";
        Map<String, Object> paramMap = new HashMap<>();
        ResponseEntity<String> cchResponseEntity = restTemplateUtil.sendHttpRequestPj(url, paramMap);
        //房屋统计
        List<JcDsGpbGdzcGridTotalHousing> houseNum = JSONObject.parseArray(cchResponseEntity.getBody(), JcDsGpbGdzcGridTotalHousing.class);

        //房屋的数据需要调取数据系统接口jc_ds_gpb_gdzc_grid_total_housing 的数据
        Map<String, List<JcDsGpbGdzcGridTotalHousing>> listMap = houseNum.stream().collect(Collectors.groupingBy(JcDsGpbGdzcGridTotalHousing::getProvince));
        Map<String, List<JcDsGpbGdzcGridTotalHousing>> cityAllMap = houseNum.stream().collect(Collectors.groupingBy(JcDsGpbGdzcGridTotalHousing::getCity));
        List<BuildingEntity> houseAllNum=dataLumeRepository.getAllBuilding();
        Map<String, List<BuildingEntity>> provinceListMap = houseAllNum.stream().collect(Collectors.groupingBy(BuildingEntity::getProvince));

        List<YpgProHouseNumCount> resultList=new ArrayList<>();
        List<YpgHouseTypeCount> cityTypeCounts=new ArrayList<>();
        List<YpgBuildMonomerCount> monomerCounts=new ArrayList<>();
        for (Map.Entry<String, List<BuildingEntity>> map : provinceListMap.entrySet()) {
            String province = map.getKey();//
            //根据省名称获取省code
            String provinceCode = dataLumeRepository.getProvinceCodeByProvinceId(province);
            List<BuildingEntity> buildingEntities = map.getValue();


            //每一个省的 房屋建筑物单体采集情况（全国）
            Map<Integer, List<BuildingEntity>> buildingYear = buildingEntities.stream()
                    .collect(Collectors.groupingBy(
                            b -> b.getCreateTime().getYear(),
                            Collectors.toList()
                    ));
            for (Map.Entry<Integer, List<BuildingEntity>> yearMap : buildingYear.entrySet()) {
                Integer year = yearMap.getKey();//年份
                int num = yearMap.getValue().size();//个数
                YpgBuildMonomerCount monomerCount=new YpgBuildMonomerCount();
                monomerCount.setId(UUIDGenerator.getUUID());
                monomerCount.setBuildMonomerNum(num);
                monomerCount.setYears(String.valueOf(year));
                monomerCount.setCode("0");
                monomerCounts.add(monomerCount);
            }



            //每个省的房屋覆盖率
            if (!province.equals("北京市")||!province.equals("上海市")||!province.equals("重庆市")||!province.equals("天津市")) {
                String coverage = String.valueOf(BigDecimal.valueOf(buildingEntities.size()).divide(BigDecimal.valueOf(listMap.get(province).size()), 2, RoundingMode.HALF_UP));
                YpgProHouseNumCount entity = new YpgProHouseNumCount();
                entity.setId(UUIDGenerator.getUUID());
                entity.setProvince(province);
                entity.setRate(coverage);
                entity.setCode("0");
                entity.setHouseNum(buildingEntities.size());
                resultList.add(entity);
            }
            //每一个市的
            Map<String, List<BuildingEntity>> cityMap = buildingEntities.stream().collect(Collectors.groupingBy(BuildingEntity::getCity));

            for (Map.Entry<String, List<BuildingEntity>> cmap : cityMap.entrySet()) {
                List<BuildingEntity> cityBuilding = cmap.getValue();//每一个市建筑物
                //每一个省的 房屋建筑物单体采集情况（全国）
                Map<Integer, List<BuildingEntity>> cityBuildingYear = cityBuilding.stream()
                        .collect(Collectors.groupingBy(
                                b -> b.getCreateTime().getYear(),
                                Collectors.toList()
                        ));
                for (Map.Entry<Integer, List<BuildingEntity>> cityYearMap : cityBuildingYear.entrySet()) {
                    Integer year = cityYearMap.getKey();//年份
                    int num = cityYearMap.getValue().size();//个数
                    YpgBuildMonomerCount monomerCount=new YpgBuildMonomerCount();
                    monomerCount.setId(UUIDGenerator.getUUID());
                    monomerCount.setBuildMonomerNum(num);
                    monomerCount.setYears(String.valueOf(year));
                    monomerCount.setCode(provinceCode);
                    monomerCounts.add(monomerCount);
                }
                String city = cmap.getKey();
                //每一个市的结构类型统计
                cityTypeCounts=dataLumeRepository.getHouseTypeByCityName(city);
                cityTypeCounts.stream().map(o -> {
                    o.setId(UUIDGenerator.getUUID());
                    o.setCode(provinceCode);
                    return o;
                })
                        .collect(Collectors.toList());
                List<BuildingEntity> value = cmap.getValue();
                String cityCoverage=String.valueOf(BigDecimal.valueOf(value.size()).divide(BigDecimal.valueOf(cityAllMap.get(city).size()),2,RoundingMode.HALF_UP));
                YpgProHouseNumCount cityEntity=new YpgProHouseNumCount();
                cityEntity.setId(UUIDGenerator.getUUID());
                cityEntity.setProvince(city);
                cityEntity.setRate(cityCoverage);
                cityEntity.setCode(provinceCode);
                cityEntity.setHouseNum(value.size());
                resultList.add(cityEntity);
            }



        }


        //房屋建筑物结构类型统计
        List<YpgHouseTypeCount> typeCounts= dataLumeRepository.getHouseType();
        typeCounts.stream().map(o -> {
            o.setId(UUIDGenerator.getUUID());
            o.setCode("0");
            return o;
        })
                .collect(Collectors.toList());
        typeCounts.addAll(cityTypeCounts);
        dataLumeRepository.delHouseNum();//大屏房屋统计数据
        dataLumeRepository.delHouseType();
        dataLumeRepository.delHouseYear();
        dataLumeRepository.saveHouseNum(resultList);//大屏房屋统计数据
        dataLumeRepository.saveHouseType(typeCounts);
        dataLumeRepository.saveHouseYear(monomerCounts);
    }

    @Override
    public void coverage3() {
        List<YpgProDamagePointCount> pointCountList=new ArrayList<>();
        //灾害风险点统计 代码-----------------------------
        List<DisasterRiskEntity> riskEntities=dataLumeRepository.getDisRisk();
        List<YpgDamagePointTypeCount> typeCountList=new ArrayList<>();
        List<YpgDamagePointSituationCount> yearList=new ArrayList<>();

        Map<Integer, List<DisasterRiskEntity>> allYear = riskEntities.stream()
                .collect(Collectors.groupingBy(
                        b -> b.getCreateTime().getYear(),
                        Collectors.toList()
                ));
        for (Map.Entry<Integer, List<DisasterRiskEntity>> cityYearMap : allYear.entrySet()) {
            Integer year = cityYearMap.getKey();//年份
            int num = cityYearMap.getValue().size();//个数
            YpgDamagePointSituationCount situationCount=new YpgDamagePointSituationCount();
            situationCount.setId(UUIDGenerator.getUUID());
            situationCount.setCode("0");
            situationCount.setYears(String.valueOf(year));
            situationCount.setDamagePointNum(String.valueOf(num));
            yearList.add(situationCount);
        }


        Map<String, List<DisasterRiskEntity>> proRiskEntitys = riskEntities.stream().collect(Collectors.groupingBy(DisasterRiskEntity::getProvince));
        for (Map.Entry<String, List<DisasterRiskEntity>> proRiskEntity : proRiskEntitys.entrySet()) {
            String province = proRiskEntity.getKey();//省名称
            String code = dataLumeRepository.getProvinceCodeByProvinceId(province);
            List<DisasterRiskEntity> riskEntityValue = proRiskEntity.getValue();//省集合
            //根据年分组

            Map<Integer, List<DisasterRiskEntity>> cityRiskYear = riskEntityValue.stream()
                    .collect(Collectors.groupingBy(
                            b -> b.getCreateTime().getYear(),
                            Collectors.toList()
                    ));
            for (Map.Entry<Integer, List<DisasterRiskEntity>> cityYearMap : cityRiskYear.entrySet()) {
                Integer year = cityYearMap.getKey();//年份
                int num = cityYearMap.getValue().size();//个数
                YpgDamagePointSituationCount situationCount=new YpgDamagePointSituationCount();
                situationCount.setId(UUIDGenerator.getUUID());
                situationCount.setCode(code);
                situationCount.setYears(String.valueOf(year));
                situationCount.setDamagePointNum(String.valueOf(num));
                yearList.add(situationCount);
            }





            if (!province.equals("北京市")||!province.equals("上海市")||!province.equals("重庆市")||!province.equals("天津市")) {
                YpgProDamagePointCount pointCount=new YpgProDamagePointCount();
                pointCount.setCode("0");
                pointCount.setId(UUIDGenerator.getUUID());
                pointCount.setProvince(province);
                pointCount.setDamagePointNum(riskEntityValue.size());
                pointCountList.add(pointCount);
            }
            Map<String, List<DisasterRiskEntity>> cityRiskEntitys = riskEntityValue.stream().collect(Collectors.groupingBy(DisasterRiskEntity::getCity));
            for (Map.Entry<String, List<DisasterRiskEntity>> cityRiskEntity : cityRiskEntitys.entrySet()) {
                String city = cityRiskEntity.getKey();//市
                List<DisasterRiskEntity> cityRiskEntityValue = cityRiskEntity.getValue();//市集合
                YpgProDamagePointCount pointCount=new YpgProDamagePointCount();
                pointCount.setCode(code);
                pointCount.setId(UUIDGenerator.getUUID());
                pointCount.setProvince(city);
                pointCount.setDamagePointNum(cityRiskEntityValue.size());
                pointCountList.add(pointCount);
            }


            //灾害风险点类型统计--------------------------
            List<DisasterRiskEntity> hpEntities = riskEntityValue.stream()
                    .filter(obj -> obj.getDisasterType().contains("hp"))//滑坡
                    .collect(Collectors.toList());
            List<DisasterRiskEntity> btEntities = riskEntityValue.stream()
                    .filter(obj -> obj.getDisasterType().contains("bt")) //崩塌
                    .collect(Collectors.toList());
            List<DisasterRiskEntity> hzEntities = riskEntityValue.stream()
                    .filter(obj -> obj.getDisasterType().contains("hz"))//火灾
                    .collect(Collectors.toList());
            List<DisasterRiskEntity> dlydEntities = riskEntityValue.stream()
                    .filter(obj -> obj.getDisasterType().contains("dlyd"))//道路拥堵
                    .collect(Collectors.toList());
            List<DisasterRiskEntity> wxpxlEntities = riskEntityValue.stream()
                    .filter(obj -> obj.getDisasterType().contains("wxpxl"))//危险品泄露
                    .collect(Collectors.toList());
            List<DisasterRiskEntity> zdEntities = riskEntityValue.stream()
                    .filter(obj -> obj.getDisasterType().contains("zd"))//中断
                    .collect(Collectors.toList());
            List<DisasterRiskEntity> qtEntities = riskEntityValue.stream()//其他
                    .filter(obj -> !obj.getDisasterType().contains("hp")||!obj.getDisasterType().contains("bt")
                            ||!obj.getDisasterType().contains("hz")||!obj.getDisasterType().contains("dlyd")
                            ||!obj.getDisasterType().contains("wxpxl")||!obj.getDisasterType().contains("zd"))
                    .collect(Collectors.toList());
            YpgDamagePointTypeCount hpDamagePointTypeCount=new YpgDamagePointTypeCount(UUIDGenerator.getUUID(),"4",String.valueOf(BigDecimal.valueOf(hpEntities.size()).multiply(BigDecimal.valueOf(100.00)).divide(BigDecimal.valueOf(riskEntities.size()),2,RoundingMode.HALF_UP)),code);
            YpgDamagePointTypeCount btDamagePointTypeCount=new YpgDamagePointTypeCount(UUIDGenerator.getUUID(),"5",String.valueOf(BigDecimal.valueOf(btEntities.size()).multiply(BigDecimal.valueOf(100.00)).divide(BigDecimal.valueOf(riskEntities.size()),2,RoundingMode.HALF_UP)),code);
            YpgDamagePointTypeCount hzDamagePointTypeCount=new YpgDamagePointTypeCount(UUIDGenerator.getUUID(),"2",String.valueOf(BigDecimal.valueOf(hzEntities.size()).multiply(BigDecimal.valueOf(100.00)).divide(BigDecimal.valueOf(riskEntities.size()),2,RoundingMode.HALF_UP)),code);
            YpgDamagePointTypeCount dlydDamagePointTypeCount=new YpgDamagePointTypeCount(UUIDGenerator.getUUID(),"1",String.valueOf(BigDecimal.valueOf(dlydEntities.size()).multiply(BigDecimal.valueOf(100.00)).divide(BigDecimal.valueOf(riskEntities.size()),2,RoundingMode.HALF_UP)),code);
            YpgDamagePointTypeCount wxpxlDamagePointTypeCount=new YpgDamagePointTypeCount(UUIDGenerator.getUUID(),"0",String.valueOf(BigDecimal.valueOf(wxpxlEntities.size()).multiply(BigDecimal.valueOf(100.00)).divide(BigDecimal.valueOf(riskEntities.size()),2,RoundingMode.HALF_UP)),code);
            YpgDamagePointTypeCount zdDamagePointTypeCount=new YpgDamagePointTypeCount(UUIDGenerator.getUUID(),"6",String.valueOf(BigDecimal.valueOf(zdEntities.size()).multiply(BigDecimal.valueOf(100.00)).divide(BigDecimal.valueOf(riskEntities.size()),2,RoundingMode.HALF_UP)),code);
            YpgDamagePointTypeCount qtDamagePointTypeCount=new YpgDamagePointTypeCount(UUIDGenerator.getUUID(),"3",String.valueOf(BigDecimal.valueOf(qtEntities.size()).multiply(BigDecimal.valueOf(100.00)).divide(BigDecimal.valueOf(riskEntities.size()),2,RoundingMode.HALF_UP)),code);
            typeCountList.add(hpDamagePointTypeCount);
            typeCountList.add(btDamagePointTypeCount);
            typeCountList.add(hzDamagePointTypeCount);
            typeCountList.add(dlydDamagePointTypeCount);
            typeCountList.add(wxpxlDamagePointTypeCount);
            typeCountList.add(zdDamagePointTypeCount);
            typeCountList.add(qtDamagePointTypeCount);
        }


        List<DisasterRiskEntity> hpEntities = riskEntities.stream()
                .filter(obj -> obj.getDisasterType().contains("hp"))//滑坡
                .collect(Collectors.toList());
        List<DisasterRiskEntity> btEntities = riskEntities.stream()
                .filter(obj -> obj.getDisasterType().contains("bt")) //崩塌
                .collect(Collectors.toList());
        List<DisasterRiskEntity> hzEntities = riskEntities.stream()
                .filter(obj -> obj.getDisasterType().contains("hz"))//火灾
                .collect(Collectors.toList());
        List<DisasterRiskEntity> dlydEntities = riskEntities.stream()
                .filter(obj -> obj.getDisasterType().contains("dlyd"))//道路拥堵
                .collect(Collectors.toList());
        List<DisasterRiskEntity> wxpxlEntities = riskEntities.stream()
                .filter(obj -> obj.getDisasterType().contains("wxpxl"))
                .collect(Collectors.toList());
        List<DisasterRiskEntity> zdEntities = riskEntities.stream()
                .filter(obj -> obj.getDisasterType().contains("zd"))//中断
                .collect(Collectors.toList());
        List<DisasterRiskEntity> qtEntities = riskEntities.stream()
                .filter(obj -> !obj.getDisasterType().contains("hp")||!obj.getDisasterType().contains("bt")
                        ||!obj.getDisasterType().contains("hz")||!obj.getDisasterType().contains("dlyd")
                        ||!obj.getDisasterType().contains("wxpxl")||!obj.getDisasterType().contains("zd"))
                .collect(Collectors.toList());
        YpgDamagePointTypeCount hpDamagePointTypeCount=new YpgDamagePointTypeCount(UUIDGenerator.getUUID(),"4",String.valueOf(BigDecimal.valueOf(hpEntities.size()).multiply(BigDecimal.valueOf(100.00)).divide(BigDecimal.valueOf(riskEntities.size()),2,RoundingMode.HALF_UP)),"0");
        YpgDamagePointTypeCount btDamagePointTypeCount=new YpgDamagePointTypeCount(UUIDGenerator.getUUID(),"5",String.valueOf(BigDecimal.valueOf(btEntities.size()).multiply(BigDecimal.valueOf(100.00)).divide(BigDecimal.valueOf(riskEntities.size()),2,RoundingMode.HALF_UP)),"0");
        YpgDamagePointTypeCount hzDamagePointTypeCount=new YpgDamagePointTypeCount(UUIDGenerator.getUUID(),"2",String.valueOf(BigDecimal.valueOf(hzEntities.size()).multiply(BigDecimal.valueOf(100.00)).divide(BigDecimal.valueOf(riskEntities.size()),2,RoundingMode.HALF_UP)),"0");
        YpgDamagePointTypeCount dlydDamagePointTypeCount=new YpgDamagePointTypeCount(UUIDGenerator.getUUID(),"1",String.valueOf(BigDecimal.valueOf(dlydEntities.size()).multiply(BigDecimal.valueOf(100.00)).divide(BigDecimal.valueOf(riskEntities.size()),2,RoundingMode.HALF_UP)),"0");
        YpgDamagePointTypeCount wxpxlDamagePointTypeCount=new YpgDamagePointTypeCount(UUIDGenerator.getUUID(),"0",String.valueOf(BigDecimal.valueOf(wxpxlEntities.size()).multiply(BigDecimal.valueOf(100.00)).divide(BigDecimal.valueOf(riskEntities.size()),2,RoundingMode.HALF_UP)),"0");
        YpgDamagePointTypeCount zdDamagePointTypeCount=new YpgDamagePointTypeCount(UUIDGenerator.getUUID(),"6",String.valueOf(BigDecimal.valueOf(zdEntities.size()).multiply(BigDecimal.valueOf(100.00)).divide(BigDecimal.valueOf(riskEntities.size()),2,RoundingMode.HALF_UP)),"0");
        YpgDamagePointTypeCount qtDamagePointTypeCount=new YpgDamagePointTypeCount(UUIDGenerator.getUUID(),"3",String.valueOf(BigDecimal.valueOf(qtEntities.size()).multiply(BigDecimal.valueOf(100.00)).divide(BigDecimal.valueOf(riskEntities.size()),2,RoundingMode.HALF_UP)),"0");
        typeCountList.add(hpDamagePointTypeCount);
        typeCountList.add(btDamagePointTypeCount);
        typeCountList.add(hzDamagePointTypeCount);
        typeCountList.add(dlydDamagePointTypeCount);
        typeCountList.add(wxpxlDamagePointTypeCount);
        typeCountList.add(zdDamagePointTypeCount);
        typeCountList.add(qtDamagePointTypeCount);




        dataLumeRepository.delRiskNum();
        dataLumeRepository.delRiskType();
        dataLumeRepository.delRiskYear();
        dataLumeRepository.saveRiskNum(pointCountList);
        dataLumeRepository.saveRiskType(typeCountList);
        dataLumeRepository.saveRiskYear(yearList);

    }
}
